package com.easychat.controller.Admin;

import com.easychat.annotation.GlobalInterceptor;
import com.easychat.controller.ABaseController;
import com.easychat.entity.po.UserInfoBeauty;
import com.easychat.entity.query.UserInfoBeautyQuery;
import com.easychat.entity.vo.PaginationResultVO;
import com.easychat.entity.vo.ResponseVO;
import com.easychat.service.UserInfoBeautyService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotEmpty;

/**
 * @Author Dongdong
 * @注释 用户联系人
 */
@RestController("adminUserInfoBeautyController")
@RequestMapping("/admin")
public class AdminUserInfoBeautyController extends ABaseController {

    @Resource
    private UserInfoBeautyService userInfoBeautyService;

    @RequestMapping("/loadBeautyAccountList")
    @GlobalInterceptor(checkAdmin = true)
    public ResponseVO loadBeautyAccountList(UserInfoBeautyQuery userInfoBeautyQuery,Integer pageNo) {
        userInfoBeautyQuery.setOrderBy("id desc");

        PaginationResultVO<UserInfoBeauty> resultVO = userInfoBeautyService.findListByPage(userInfoBeautyQuery);

        return getSuccessResponseVO(resultVO);
    }
    @RequestMapping("/saveBeautAccount")
    @GlobalInterceptor(checkAdmin = true)
    public ResponseVO saveBeautAccount( @NotEmpty String email,  @NotEmpty String userId) {
        UserInfoBeauty userInfoBeauty = new UserInfoBeauty();
        userInfoBeauty.setEmail(email);
        userInfoBeauty.setUserId(userId);
        userInfoBeautyService.saveBeautAccount(userInfoBeauty);

        return getSuccessResponseVO(null);
    }

    @RequestMapping("/delBeautAccount")
    @GlobalInterceptor(checkAdmin = true)
    public ResponseVO delBeautAccount( @NotEmpty Integer id) {
        userInfoBeautyService.deleteUserInfoBeautyById(id);

        return getSuccessResponseVO("删除成功");
    }





}
